home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_06
/
9n06055b
< prev
next >
Wrap
Text File
|
1991-02-23
|
1KB
|
57 lines
//
// class IntThing -- an integer thing derived from
// class Thing.
//
// Version 1.01 -- 2/25/91
//
// Michael Kelly -- Author
//
#include <stdio.h>
#include "th_int.hpp"
void IntThing::print()
{
printf("%d\n", (int)*this);
}
IntThing::operator ==(Thing &some_thing)
{
return ( type() == some_thing.type() ) ?
( *((int *)ptr()) == *((int *)some_thing.ptr()) ) : 0;
}
IntThing::operator !=(Thing &some_thing)
{
return ( type() == some_thing.type() ) ?
( *((int *)ptr()) != *((int *)some_thing.ptr()) ) : 0;
}
IntThing::operator < (Thing &some_thing)
{
return ( type() == some_thing.type() ) ?
( *((int *)ptr()) < *((int *)some_thing.ptr()) ) : 0;
}
IntThing::operator <=(Thing &some_thing)
{
return ( type() == some_thing.type() ) ?
( *((int *)ptr()) <= *((int *)some_thing.ptr()) ) : 0;
}
IntThing::operator > (Thing &some_thing)
{
return ( type() == some_thing.type() ) ?
( *((int *)ptr()) > *((int *)some_thing.ptr()) ) : 0;
}
IntThing::operator >=(Thing &some_thing)
{
return ( type() == some_thing.type() ) ?
( *((int *)ptr()) >= *((int *)some_thing.ptr()) ) : 0;
}